
//Buffer.concat(list[, totalLength]) Buffer合并

var buf1=new Buffer("张");
var buf2=new Buffer("三");
var buf3=new Buffer("是");
var buf4=new Buffer("帅");
var buf5=new Buffer("哥");

var result=Buffer.concat([buf1,buf2,buf3,buf4,buf5],15).toString();
console.log(result);

//截取 slice
var all=Buffer.concat([buf1,buf2,buf3,buf4,buf5],15);
var s=all.slice(9,12);
console.log(s.toString());

//复制 buf.copy(targetBuffer[, targetStart[, sourceStart[, sourceEnd]]])
var buffers=new Buffer(15);
buf1.copy(buffers,0,0,3);
buf2.copy(buffers,3,0,3);
buf3.copy(buffers,6,0,3);

console.log(buffers.toString("utf8",0,9));

//字节长度
console.log(Buffer.byteLength("ab玩哇！"));